﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bzure.Common.Data;
using Bzure.Security.Principal;

namespace Bzure.Apps.Security.DataAccess
{
    public class UserGroupMapRepository : RepositoryBase
    {
        static UserGroupMapRepository()
        {
            UserGroupMap entity = new UserGroupMap();
            Type type = entity.GetType();
            AppendDataMap(type, "UserID", () => entity.UserID);
            AppendDataMap(type, "ID", () => entity.ID);
            AppendDataMap(type, "GroupID", () => entity.GroupID);
            ResultMapDelegate<UserGroupMap> queryMap = UserGroupMap_Map;
            QueryMapContainer[entity.GetType()] = queryMap;



        }
        public UserGroupMapRepository(Bzure.Common.Transactions.ITransactionSupport contractProvider)
            : base(contractProvider)
        {

        }
        public override string TableName
        {
            get
            {
                return "T_Security_UserGroupMaps";
            }
        }
        /// <summary>
        /// 用户实体数据映射
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static UserGroupMap UserGroupMap_Map(DataReader reader)
        {
            UserGroupMap BzureUser = new UserGroupMap()
            {
                GroupID = reader.GetStringNullable("GroupID"),
                ID = reader.GetStringNullable("ID"),
                UserID = reader.GetStringNullable("UserID")
            };
            return BzureUser;
        }
    
    }
}
